<template>
  用户名：<input type="text" v-model="state.loginData.userName" />
  密码：<input type="password" v-model="state.loginData.password"/>
  <input type="submit" value="登录" @click="loginSubmit" />
  <br>
  <tr v-for="p in state.processes" :key="p.id">
    <td>{{p.id}}---------{{p.name}}---------{{ p.workingSet}}</td>
  </tr>
</template>

<script>
import axios from 'axios';
import { reactive, onMounted } from "vue";
export default {  
  name: 'Login',
  setup(){
    const state=reactive({loginData:{},processes:[]});
    const loginSubmit= async ()=>{
      const payload = state.loginData;
      const resp = await axios.post('https://localhost:7271/api/Login/Login',payload);
      const data = resp.data;
      if(!data.ok){
        alert("登录失败")
      }
      state.processes = data.processInfo;
      console.log(state.processes);
    }
    return {state,loginSubmit};
  }
}
</script>